{include file="public/header"}
<body>
	<div class="sectionY">
		<a href="javascript:history.back();">
			<img src="__PUBLIC__/home/images/a19.png" alt="" class="a1">
		</a>
		<p class="p1">提现</p>
	</div>
	<div class="kong1" style=""></div>
	<div class="tixian_section1">
		<div class="f1 clearfix">
			<span class="s1">当前可提现</span>
			<span class="s2">￥{$user.commission_ready}</span>
		</div>
		<form action="">
			<div class="f2 clearfix">
				<div class="a1">
					<p class="p1">金额</p>
				</div>
				<div class="a2">
					<span class="s1">￥</span><input type="text" value="0.00" id="commission" data-commission="{$rate.user_withdraw_min}" readonly placeholder="0.00"><span class="s2" onclick="$('#commission').val('{$user.commission_ready}')">全部提现</span>
				</div>
			</div>
			<div class="f3 clearfix all_f">
				<div class="a1 clearfix">
					<span class="s1">提现到</span>
					<p class="p1" num="0">
						<img src="__PUBLIC__/home/images/a33.png" alt="" class="im1">
						<img src="__PUBLIC__/home/images/a34.png" alt="" class="im2">
						<span class="z1">银行卡</span>
					</p>
					<p class="p1" num="1">
						<img src="__PUBLIC__/home/images/a33.png" alt="" class="im1">
						<img src="__PUBLIC__/home/images/a34.png" alt="" class="im2">
						<span class="z1">支付宝</span>
					</p>
				</div>
				<div class="arr">
					<div class="a2 bank_code" style="display: none;">
						<div style="height: 35px;line-height: 35px; margin: 5px;">
							<span style="width: 20%; float:left; font-size: 16px;">姓名</span>
							<span style="width: 80%; float: right; text-align: right">
								<input type="text" class="user_name" style="width: 80%;height: 30px; border: 0; font-size: 16px;" placeholder="请输入姓名">
							</span>
						</div>
						<div style="height: 35px;line-height: 35px; margin: 5px;">
							<span style="width: 20%; float:left; font-size: 16px;">银行</span>
							<span style="width: 80%; float: right; text-align: right">
								<input type="text" class="bank_name" style="width: 80%;height: 30px; border: 0; font-size: 16px;" placeholder="请输入银行名称">
							</span>
						</div>
						<div style="height: 35px;line-height: 35px; margin: 5px;">
							<span style="width: 20%; float:left; font-size: 16px;">银行卡号</span>
							<span style="width: 80%; float: right; text-align: right">
								<input type="text" class="bank_num" style="width: 80%;height: 30px; border: 0; font-size: 16px;" placeholder="请输入银行卡号">
							</span>
						</div>
					</div>
					<div class="a3 clearfix bank_code" style="display: none;">
						<div style="height: 35px;line-height: 35px; margin: 5px;">
							<span style="width: 20%; float:left; font-size: 16px;">姓名</span>
							<span style="width: 80%; float: right; text-align: right">
								<input type="text" class="user_name" style="width: 80%;height: 30px; border: 0; font-size: 16px;" placeholder="请输入姓名">
							</span>
						</div>
						<div style="height: 35px;line-height: 35px; margin: 5px; display: none;">
							<span style="width: 20%; float:left; font-size: 16px;">姓名</span>
							<span style="width: 80%; float: right; text-align: right">
								<input type="text"  class="bank_name" value="支付宝" style="width: 80%;height: 30px; border: 0; font-size: 16px;" placeholder="请输入姓名">
							</span>
						</div>
						<div style="height: 35px;line-height: 35px; margin: 5px;">
							<span style="width: 20%; float:left; font-size: 16px;">账号</span>
							<span style="width: 80%; float: right; text-align: right">
								<input type="text" class="bank_num" style="width: 80%;height: 30px; border: 0; font-size: 16px;" placeholder="请输入支付宝账号">
							</span>
						</div>
					</div>
				</div>
			</div>
			<div class="f4">
				<p class="p1">温馨提示：请准确填写您的提现账号信息，以免线下打款失误。<br>提现手续费费率{$rate.withdraw_rate}%,可用佣金满{$rate.user_withdraw_min}元才能申请提现。</p>
			</div>
			<div class="sub">
				<input type="button" id="submit" value="提现">
			</div>
		</form>
	</div>
	
</body>
<script>
	$(function(){
		$(".im1").click(function(){
			$(this).hide().siblings(".im2").show();
			$(this).parent().siblings().children(".im2").hide().siblings(".im1").show();
			var dd = $(this).parent().attr("num");
			$(".arr>div").eq(dd).show().siblings().hide();
		})
		
		$("#submit").click(function () {
			let com_ready = parseFloat($("#commission").val()), commission = parseFloat($("#commission").data("commission"));
			if(com_ready<commission){
				modal.msg("提现金额小于最低提现额");
				return ;
			}
			if($(".bank_code:visible").length == 0){
				modal.msg("选择提现方式后在提交");
				return ;
			}
			let bank_name = $(".bank_code:visible").find(".bank_name").val(),user_name = $(".bank_code:visible").find(".user_name").val(),bank_num = $(".bank_code:visible").find(".bank_num").val();
			let data = {
				bank_name:bank_name,
				user_name:user_name,
				bank_num:bank_num,
				com_ready:com_ready
			};
			$.post("{:url('withdraw')}", data, function (res) {
				modal.msg(res.result_info);
				if(res.result_code == 0){
					location.reload();
				}
			});


		});
	})
</script>

</html>